<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>a管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
	$(document).ready(function() {
		
	});
	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
<style type="text/css">
    .uploadify-button {
        background-color: transparent;
        border: none;
        padding: 0;
    }
    .uploadify:hover .uploadify-button {
        background-color: transparent;
    }
</style>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/hang/yunshan/tbTalentPrize/">a列表</a></li>
		<shiro:hasPermission name="hang:yunshan:tbTalentPrize:edit"><li><a href="${ctx}/hang/yunshan/tbTalentPrize/form">a添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="tbTalentPrize" action="${ctx}/hang/yunshan/tbTalentPrize/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>级别：</label>
				<form:select path="level" class="input-medium">
					<form:option value="" label=""/>
					<form:options items="${fns:getDictList('a_prize_level')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
				</form:select>
			</li>
			<li><label>名称：</label>
				<form:input path="title" htmlEscape="false" maxlength="100" class="input-medium"/>
			</li>
			<li><label>姓名：</label>
				<form:input path="name" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			<li><label>时间：</label>
				<input name="time" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${tbTalentPrize.time}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>年度：</label>
				<form:input path="year" htmlEscape="false" maxlength="10" class="input-medium"/>
			</li>
			<li><label>备注：</label>
				<form:input path="description" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<!-- <li class="btns"><input id="btnDc" class="btn btn-primary" type="button" value="导出"/></li> -->
			<li class="btns"><input id="btnDownDrTmpl" class="btn btn-primary" type="button" value="下载导入模板"/></li>
			<li class="btns"><input id="btnDr" class="btn btn-primary" type="button" value="导入"/></li>
			<li class="clearfix"></li>
		</ul>
		<script>
			$('#btnDc').on('click', function(){
				alert('#btnDc clicked');
			});
			
			$('#btnDownDrTmpl').on('click', function(){
				window.open('/servlet/downloadfile?className=tbTalentPrize');
			});

			$("#btnDr").uploadify({
				auto:false,
				fileTypeDesc:"Image Files",
				fileTypeExts:"*.xls; *.xlsx;",
				queueSizeLimit:	1,//限制上传文件的数量
				auto:	true,
				multi:	false,//是否允许多文件上传
				simUploadLimit:	1,//同时运行上传的进程数量
				folder:"uploads",//上传文件存放的路径,请保持与uploadFile.jsp中PATH的值相同		
				swf:"/static/jquery-uploadify/uploadify.swf",
				uploader:'/servlet/Upload?className=tbTalentPrize',
				buttonText:	"导入",
				buttonImage : '/static/substat/dr.png',
				cancelImg:"/static/jquery-uploadify/uploadify-cancel.png",
				//formData:{'name':'liudong','age':22},//自定义参数，method必须为get
				method:"get"
			});
		</script>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>级别</th>
				<th>名称</th>
				<th>姓名</th>
				<th>时间</th>
				<th>年度</th>
				<th>备注</th>
				<shiro:hasPermission name="hang:yunshan:tbTalentPrize:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="tbTalentPrize">
			<tr>
				<td><a href="${ctx}/hang/yunshan/tbTalentPrize/form?id=${tbTalentPrize.id}">
					${fns:getDictLabel(tbTalentPrize.level, 'a_prize_level', '')}
				</a></td>
				<td>
					${tbTalentPrize.title}
				</td>
				<td>
					${tbTalentPrize.name}
				</td>
				<td>
					<fmt:formatDate value="${tbTalentPrize.time}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${tbTalentPrize.year}
				</td>
				<td>
					${tbTalentPrize.description}
				</td>
				<shiro:hasPermission name="hang:yunshan:tbTalentPrize:edit"><td>
    				<a href="${ctx}/hang/yunshan/tbTalentPrize/form?id=${tbTalentPrize.id}">修改</a>
					<a href="${ctx}/hang/yunshan/tbTalentPrize/delete?id=${tbTalentPrize.id}" onclick="return confirmx('确认要删除该a吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
<script type="text/javascript">
	function tbTalentPrizePreview(){
		var ols = $('#contentTable').find('ol');

		for(var i=0;i<ols.length;i++) {
			var ol = ols[i];
			var v = $(ol).prev().val();

			var li, urls = v.split("|");
			//$("#tbTalentPrizePreview").children().remove();
			console.log('urls: '+urls);
			for (var i=0; i<urls.length; i++){
				if (urls[i]!=""){
					li = "<li><img src=\""+urls[i]+"\" url=\""+urls[i]+"\" style=\"border:0;padding:3px;\">";
					li = "<li><a href=\""+urls[i]+"\" url=\""+urls[i]+"\" target=\"_blank\">"+decodeURIComponent(urls[i].substring(urls[i].lastIndexOf("/")+1))+"</a></li>";
					$(ol).append(li);
				}
			}
			if ($(ol).text() == ""){
				$(ol).html("<li style='list-style:none;padding-top:5px;'>无</li>");
			}
		}
	}
	tbTalentPrizePreview();
</script>
</body>
</html>